Total Complexity | 2 |
Total Lines | 22 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | import { |
||
19 | |||
20 | @Controller('users') |
||
21 | @ApiTags('User') |
||
22 | @ApiBearerAuth() |
||
23 | @UseGuards(AuthGuard('bearer'), RolesGuard) |
||
24 | export class RemoveUserAction { |
||
25 | constructor( |
||
26 | @Inject('ICommandBus') |
||
27 | private readonly commandBus: ICommandBus |
||
28 | ) {} |
||
29 | |||
30 | @Delete(':id') |
||
31 | @Roles(UserRole.PHOTOGRAPHER) |
||
32 | @ApiOperation({ summary: 'Remove user' }) |
||
33 | public async index( |
||
34 | @Param() { id }: IdDTO, |
||
35 | @LoggedUser() user: UserAuthView |
||
36 | ) { |
||
37 | try { |
||
38 | await this.commandBus.execute(new RemoveUserCommand(id, user.id)); |
||
39 | } catch (e) { |
||
40 | throw new BadRequestException(e.message); |
||
41 | } |
||
44 |